import { asyncDownloadExcel } from '@/libs/util'
// 定义一个混入对象
const downloadExcel = {
  methods: {
    // options: {
    //   $el: this.$refs.table.$el.children[0].children[3], // 固定表格，实际上有多个表格叠加，所以取一个表格即可
    //   filename: this.$t('charge_history')
    // }
    exportExcel () {
      const el = this.$refs.table.$el.children[0].children.length > 3
        ? this.$refs.table.$el.children[0].children[3]
        : this.$refs.table.$el
      asyncDownloadExcel({
        $el: this.tableEl || el,
        filename: this.tableExcelName || 'excel'
      })
    }
  }
}

export default downloadExcel
